home *** CD-ROM | disk | FTP | other *** search
- * ╔══════════════════════════════════════════════════════════════════════╗
- * ║ DDPRINT.PRG ║
- * ╠══════════════════════════════════════════════════════════════════════╣
- * ║ ║
- * ║ Author: Gene Clark (202)252-6363 ║
- * ║ Created: October 20, 1985 ║
- * ╚══════════════════════════════════════════════════════════════════════╝
- *
- * This program prints the data dictionary of your designated dBASEIII
- * file, contained in the *.DIC file created by the DDGEN.PRG command
- * file. You supply the dBASEIII data file name, and this program supplies
- * the rest.
- *
- SET TALK OFF
- SET DELIM OFF
- CLEAR ALL
- CLEAR
- ACTIVE=.T.
- DO WHILE ACTIVE
- CLEAR
- @ 1,10 SAY "╔══════════════════════════════════════════════════════╗"
- @ 2,10 SAY "║ dBASE III Database Data Dictionary Printer ║"
- @ 3,10 SAY "╚══════════════════════════════════════════════════════╝"
- @ 5,3 SAY " This program prints the dBASEIII data dictionary for a data file you"
- @ 6,3 SAY " specify. The data dictionary is actually a dBASEIII data base file"
- @ 7,3 SAY " with the same filename as your data file, but with an extent of .DIC ."
- @ 8,3 SAY " Once a .DIC file is created, it can be USEd like any .DBF file as"
- @ 9,3 SAY " long as you USE it with the fully qualified name. You will be asked"
- @ 10,4 SAY "to provide the dBASEIII data base file name; the program will find"
- @ 11,4 SAY "the associated .DIC file and print or display the data dictionary"
- @ 12,4 SAY "information."
- @ 14,0
- ACCE " Please enter the database name: " TO NFILE
- NFILE = UPPER(NFILE)
- DFILE = NFILE+".DIC"
- MFILE = NFILE+".DBF"
- @ 16,0 CLEAR
- * look for the .DIC - if it's not there, exit
- IF .NOT. FILE('&DFILE')
- @ 15,10 SAY "File &DFILE doesn't exist... EXITING."
- SET DELIM ON
- RETURN
- ENDIF
- USE &DFILE
- DEFN = DEFINITION
- CLEAR
- WAIT "Display or Print the data dictionary?" TO P
- P=UPPER(P)
- @ 1,0 CLEAR
- IF P = "P"
- ACCEPT "Turn on the printer and press <CR> =======> " TO X
- CLEAR
- @ 10,20 SAY "Printing the data dictionary for "+MFILE
- SET DEVICE TO PRINT
- ENDIF
- COUNTER=1
- HEADING=.T.
- GO 2
- DO WHILE .NOT. EOF()
- IF HEADING
- @ 1,0 SAY "dBASEIII DATA BASE FILE DICTIONARY"
- @ 1,57 SAY "Today's Date:"
- @ 1,71 SAY DATE()
- @ 3,0 SAY "Data File: " + MFILE
- @ 3,40 SAY "Dictionary File: " + DFILE
- @ 4,0 SAY "File Description: " + DEFN
- @ 5,0 SAY "======================================================="
- @ 5,55 SAY "========================"
- @ 6,0 SAY "Num Field Name T Len Dec"
- @ 6,45 SAY "Field Definition"
- @ 7,0 SAY "=== ========== = === ==="
- @ 7,25 SAY "======================================================"
- LINE=8
- HEADING=.F.
- ENDIF
- @ LINE,0 SAY NUM
- @ LINE,4 SAY FIELD_NAME
- @ LINE,15 SAY T
- @ LINE,17 SAY LEN
- @ LINE,21 SAY DEC
- @ LINE,25 SAY DEFINITION
- SKIP
- LINE = LINE+1
- COUNTER = COUNTER+1
- IF (LINE>56.AND.P="P")
- HEADING=.T.
- EJECT
- ENDIF
- IF (LINE>23.AND.P<>"P")
- HEADING=.T.
- WAIT " Hit any key to continue" TO X
- CLEAR
- ENDIF
- ENDDO
- STORE LINE+1 TO LINE
- IF (LINE> 23.AND.P<>"P")
- CLEAR
- LINE = 5
- ENDIF
- @ LINE,0 SAY "_______________________________________________________"
- @ LINE,55 SAY "________________________"
- IF P<>"P"
- WAIT " Last of Dictionary Lines -- Hit Any Key to Continue" TO X
- ENDIF
- SET DEVI TO SCREEN
- * finished printing
- IF P = "P"
- EJECT
- ENDIF
- CLEAR
- * check to see if there are any more files to be printed
- STORE ' ' TO ANS
- DO WHILE AT(ANS,'YN')=0
- @ 10,0 SAY "Do you wish to print another database dictionary ? " ;
- GET ANS PICT '!'
- READ
- ENDDO
- * if not, exit the loop and the program
- IF ANS='N'
- STORE .F. TO ACTIVE
- ENDIF
- ENDDO
- @ 10,0
- @ 10,18 SAY "Data Dictionary(ies) Printed -- Job Finished"
- SET DELIM ON
- RETURN
- ********* END OF FILE
-